package com.hibernate.learn2.models;

import javax.persistence.*;

@Entity
@Table(name = "Passport")
public class Passport extends MappedSuper {

    public Passport() {}

    public Passport(int serial) {
        this.serial = serial;
    }

    public Passport(int serial, Person owner) {
        this.serial = serial;
        this.owner = owner;
    }


    @Column
    private int serial;

    public int getSerial() {
        return serial;
    }

    public void setSerial(int serial) {
        this.serial = serial;
    }

    @OneToOne(mappedBy = "passport", optional = false)
    private Person owner;

    public Person getOwner() {
        return owner;
    }

    public void setOwner(Person owner) {
        this.owner = owner;
    }
}